home *** CD-ROM | disk | FTP | other *** search
/ Shirase 13 / Shirase CD 13.iso / Extra / mp71.exe / 1033 / RCDATA / CABINET / wmploc.DLL / 256 / 142 < prev    next >
Text (UTF-16)  |  2001-05-14  |  30KB  |  568 lines

  1. // Windows Media Player  - Copyright 2000 Microsoft Corporation.
  2.  
  3. var g_strPlayImage="";
  4. var g_strPlayHover="";
  5. var g_strPlayDown="";
  6. var g_strPauseHover="";
  7. var g_strPauseDown="";
  8.  
  9. var g_psPlayState=0;
  10. var g_osOpenState=0;
  11. var g_fIsLiveBroadcast=false;
  12. var g_fShowingBuyMe=false;
  13.  
  14. function InitMiniControls()
  15. {
  16.     g_strPlayImage="res://wmploc.dll/RT_BITMAP/#373";
  17.     g_strPlayHover="res://wmploc.dll/RT_BITMAP/#374";
  18.     g_strPlayDown="res://wmploc.dll/RT_BITMAP/#375";
  19.     g_strPauseUp="res://wmploc.dll/RT_BITMAP/#427";
  20.     g_strPauseHover="res://wmploc.dll/RT_BITMAP/#423";
  21.     g_strPauseDown="res://wmploc.dll/RT_BITMAP/#424";
  22.  
  23.     player.settings.enableErrorDialogs = false;
  24.  
  25.     OnOpenStateChangeTransport();
  26.     OnPlayStateChangeTransport();
  27.     OnStatusChangeTransport();
  28. }
  29.  
  30. function InitControls()
  31. {
  32.     g_strPlayImage="res://wmploc.dll/RT_BITMAP/#294";
  33.     g_strPlayHover="res://wmploc.dll/RT_BITMAP/#293";
  34.     g_strPlayDown="res://wmploc.dll/RT_BITMAP/#292";
  35.     g_strPauseUp="res://wmploc.dll/RT_BITMAP/#288";
  36.     g_strPauseHover="res://wmploc.dll/RT_BITMAP/#289";
  37.     g_strPauseDown="res://wmploc.dll/RT_BITMAP/#290";
  38.  
  39.     OnOpenStateChangeTransport();
  40.     OnPlayStateChangeTransport();
  41.     OnStatusChangeTransport();
  42. }
  43.  
  44. function InitBuyMe()
  45. {
  46.     var BuyBMP = mediacenter.getNamedString("BuyMusicButton");
  47.     var BuyURL = mediacenter.getNamedString("BuyMusicURL");
  48.  
  49.     if (BuyBMP != "" && BuyURL != "")
  50.     {
  51.         buyme.Image     = 'BuyMusicButton';
  52.         g_fShowingBuyMe = true;
  53.         ShowBuyMe();
  54.     }
  55. }
  56.  
  57. function ShowBuyMe()
  58. {
  59.     if (g_fShowingBuyMe == true)
  60.     {
  61.         buyme.visible = (buyme.left > (bgSeekCtls.left + bgSeekCtls.width + 15));
  62.     }
  63. }
  64.  
  65. function LaunchBuy()
  66. {
  67.     var BuyURL = 'http://www.microsoft.com/isapi/redir.dll?Prd=windows&Sbp=MediaPlayer&Pver=7&ar=MediaBuy&Sba=' + mediacenter.getNamedString("BuyMusicURL");
  68.     player.launchURL( BuyURL );
  69. }
  70.  
  71. function MetaDataObject( label, str, url, tooltip )
  72. {
  73.     this.label = label;
  74.     this.str = str;
  75.     this.url = url;
  76.     this.tooltip = tooltip;
  77. }
  78.  
  79. var g_sMetaDataItems= new Array( "play", "show",   "clip",   "author",   "copyright",   "drm" );
  80. var g_sAudioLabels = new Array(  "",     "2070",   "2071",   "2072",     "2076",        "2078" );
  81. var g_sVideoLabels = new Array(  "",     "2073",   "2074",   "2075",     "2076",        "2078" );
  82.  
  83. function GetItemInfo(obj, strItem)
  84. {
  85.     var str;
  86.     
  87.     str = obj.getItemInfo(strItem);
  88.  
  89.     return (str)    
  90. }
  91.  
  92. function GetMetaData(itemIndex, data)
  93. {
  94.     data.url = "";
  95.     data.tooltip = "";
  96.  
  97.     if (player.currentMedia.imageSourceWidth > 0)
  98.     {
  99.         data.label = g_sVideoLabels[itemIndex];
  100.     }
  101.     else
  102.     {
  103.         data.label = g_sAudioLabels[itemIndex];
  104.     }
  105.  
  106.     if ("" != data.label)
  107.     {
  108.         data.label = theme.loadString("res://wmploc.dll/RT_STRING/#" + data.label);
  109.     }
  110.  
  111.     switch (itemIndex)
  112.     {
  113.         case 0:
  114.             data.str = player.status;
  115.             break;
  116.  
  117.         case 1:
  118.             data.str = GetItemInfo(player.currentPlaylist, "title");
  119.             if ("" == data.str)
  120.                 data.str = GetItemInfo(player.currentMedia, "Album");
  121.             data.url = GetItemInfo(player.currentPlaylist, "moreinforef");
  122.             data.tooltip = GetItemInfo(player.currentPlaylist, "abstract");
  123.             break;
  124.         case 2:
  125.             data.str = GetItemInfo(player.currentMedia, "title");
  126.             data.url = GetItemInfo(player.currentMedia, "moreinforef");
  127.             data.tooltip = GetItemInfo(player.currentMedia, "abstract");
  128.             break;
  129.         case 3:
  130.             data.str = GetItemInfo(player.currentMedia, "author");
  131.             break;
  132.         case 4:
  133.             data.str = GetItemInfo(player.currentMedia, "copyright");
  134.             break;
  135.         case 5:
  136.             data.str = "";
  137.             if ("true" == player.currentMedia.getItemInfo("Is_Protected"))
  138.             {
  139.                 if ("true" == player.currentMedia.getItemInfo("Is_Trusted"))
  140.                 {
  141.                     data.str = player.currentMedia.getItemInfo("Signature_Name");
  142.                 }
  143.                 else
  144.                 {
  145.                     data.str = theme.loadString("res://wmploc.dll/RT_STRING/#2077");
  146.                     data.label = "";
  147.                 }
  148.             }
  149.             break;
  150.     }
  151. }
  152.  
  153. function ShowMetaData(data)
  154. {
  155.     if ("" != data.str)
  156.     {
  157.         if ("" != data.label)
  158.         {
  159.             var re;
  160.             re = /%s/i;
  161.             metadata.value = data.label.replace(re, data.str);
  162.         }
  163.         else
  164.         {
  165.             metadata.value = data.str;
  166.         }
  167.  
  168.         metadata.tooltip = data.tooltip;
  169.  
  170.         if ("" != data.url)
  171.         {
  172.             metadata.hoverFontStyle = "underline";
  173.             metadata.enabled = true;
  174.         }
  175.         else
  176.         {
  177.             metadata.hoverFontStyle = "normal";
  178.             metadata.enabled = false;
  179.         }
  180.     }
  181.     else
  182.     {
  183.         ShowStatus("");
  184.     }
  185. }
  186.  
  187. function ShowStatus(sStr)
  188. {
  189.     metadata.value = sStr;
  190.     metadata.hoverFontStyle = "normal";
  191.     metadata.tooltip = "";
  192.     metadata.enabled = false;
  193. }
  194.  
  195. var g_iNextMetaDataIndex = 0;
  196. var g_metaDataInfo = new MetaDataObject("", "", "", "");
  197.  
  198. function RotateMetaData()
  199. {
  200.     for (i = 0; i < g_sMetaDataItems.length; i++)
  201.     {
  202.         GetMetaData(g_iNextMetaDataIndex, g_metaDataInfo);
  203.  
  204.         g_iNextMetaDataIndex++;
  205.         if (g_iNextMetaDataIndex == g_sMetaDataItems.length)
  206.             g_iNextMetaDataIndex = 0;
  207.     
  208.         if ("" != g_metaDataInfo.str)
  209.         {
  210.             ShowMetaData(g_metaDataInfo);
  211.             return;
  212.         }
  213.     }
  214.  
  215.     ShowStatus("");
  216. }
  217.  
  218. function ForceMetaData(itemIndex)
  219. {
  220.     g_iNextMetaDataIndex = itemIndex;
  221.     GetMetaData(itemIndex, g_metaDataInfo);
  222.     ShowMetaData(g_metaDataInfo);
  223. }
  224.  
  225. function OnClickMetaData()
  226. {
  227.     if ("" != g_metaDataInfo.url)
  228.         player.launchURL(g_metaDataInfo.url);
  229. }
  230.  
  231. function UpdateReceptionQuality()
  232. {
  233.     var nReceptionQuality = player.network.receptionQuality;
  234.     if (nReceptionQuality > 0)
  235.     {
  236.         if(nReceptionQuality == 100)
  237.         {
  238.             QualityIcon.image = "res://wmploc.dll/RT_IMAGE/qbest.gif";
  239.             QualityIcon.upToolTip="res://wmploc.dll/RT_STRING/#2079";
  240.         }
  241.         else if(nReceptionQuality < 99 &&  nReceptionQuality > 86    )
  242.         {
  243.             QualityIcon.image = "res://wmploc.dll/RT_IMAGE/qOK.gif";
  244.             QualityIcon.upToolTip="res://wmploc.dll/RT_STRING/#2080";
  245.         }
  246.         else if(nReceptionQuality < 86 &&  nReceptionQuality > 0 )
  247.         {
  248.             QualityIcon.image = "res://wmploc.dll/RT_IMAGE/qbad.gif";
  249.             QualityIcon.upToolTip="res://wmploc.dll/RT_STRING/#2081";
  250.         }
  251.  
  252.         QualityIcon.visible=true;
  253.     }
  254.     else
  255.     {
  256.         QualityIcon.image = "res://wmploc.dll/RT_IMAGE/qbest.gif";
  257.         QualityIcon.upToolTip="";
  258.         QualityIcon.visible=true;
  259.     }
  260. }
  261.  
  262. function OnTimerTransport()
  263. {
  264.     if (osMediaOpen != g_osOpenState)
  265.         return;
  266.     
  267.     switch(g_psPlayState)
  268.     {
  269.         case psPlaying:
  270.             UpdateReceptionQuality();
  271.             RotateMetaData();        
  272.             break;
  273.     }
  274. }
  275.  
  276. function OnStatusChangeTransport()
  277. {
  278.     ShowStatus(player.status);
  279. }
  280.  
  281. function OnBufferingChangeTransport()
  282. {
  283.     var nProgress = player.network.bufferingprogress;
  284.     if ((nProgress > 0) && (nProgress < 100))
  285.     {
  286.         ShowStatus(player.status);
  287.         QualityIcon.image = "res://wmploc.dll/RT_IMAGE/buffering.gif";
  288.         QualityIcon.upToolTip="";
  289.     }
  290. }
  291.  
  292. function OnDisconnectTransport()
  293. {
  294.     ShowStatus(theme.loadString("res://wmploc.dll/RT_STRING/#2063"));
  295. }
  296.  
  297. function playOnClick()
  298. {
  299.     if (player.PlayState == psPlaying)
  300.     {
  301.         player.controls.pause();
  302.     }
  303.     else
  304.     {
  305.         player.controls.play();
  306.     }
  307. }
  308.  
  309. function OnFFWD()
  310. {
  311.     if (player.PlayState == psScanForward)
  312.     {
  313.         player.controls.play();
  314.     }
  315.     else
  316.     {
  317.         player.controls.FastForward();
  318.     }
  319. }
  320.         
  321. function OnREW()
  322. {
  323.     if (player.PlayState == psScanReverse)
  324.     {
  325.         player.controls.play();
  326.     }
  327.     else
  328.     {
  329.         player.controls.FastReverse();
  330.     }
  331. }
  332.  
  333. function volumeOnChange()
  334. {
  335.     player.settings.mute=false;
  336. }
  337.  
  338. function muteOnClick()
  339. {
  340.     player.settings.mute = (player.settings.mute == true) ? false : true;
  341. }
  342.  
  343. function OnPlayStateChangeTransport()
  344. {
  345.     g_psPlayState = player.PlayState;
  346.     
  347.     switch (g_psPlayState)
  348.     {
  349.     case psUndefined:
  350.             QualityIcon.visible=false;
  351.             QualityIcon.upToolTip = "";
  352.             tracktime.visible=false;
  353.             seek.foregroundProgress = 0;
  354.             play.image=g_strPlayImage;
  355.             play.disabledImage=g_strPlayImage;
  356.             play.hoverImage=g_strPlayHover;
  357.             play.downImage=g_strPlayDown;
  358.             play.upToolTip="res://wmploc.dll/RT_STRING/#1800";
  359.             play.enabled=false;
  360.             rew.down=false;
  361.             ffwd.down=false;
  362.         break;
  363.  
  364.     case psTransitioning:
  365.             tracktime.visible=false;
  366.             play.image=g_strPlayImage;
  367.             play.disabledImage=g_strPlayImage;
  368.             play.hoverImage=g_strPlayHover;
  369.             play.downImage=g_strPlayDown;
  370.             play.upToolTip="res://wmploc.dll/RT_STRING/#1800";
  371.             play.enabled=false;
  372.             rew.down=false;
  373.             ffwd.down=false;
  374.         break;            
  375.         
  376.     case psReady:
  377.             QualityIcon.visible=false;
  378.             QualityIcon.upToolTip = "";
  379.             tracktime.visible=false;
  380.             seek.foregroundProgress = 0;
  381.             play.image=g_strPlayImage;
  382.             play.disabledImage=g_strPlayImage;
  383.             play.hoverImage=g_strPlayHover;
  384.             play.downImage=g_strPlayDown;
  385.             play.upToolTip="res://wmploc.dll/RT_STRING/#1800";
  386.             play.enabled=true;
  387.             rew.down=false;
  388.             ffwd.down=false;
  389.         break;
  390.  
  391.     case psStopped:
  392.             QualityIcon.visible=true;
  393.             QualityIcon.image = "res://wmploc.dll/RT_IMAGE/stopped.gif";
  394.             QualityIcon.upToolTip = "";
  395.             play.image=g_strPlayImage;
  396.             play.disabledImage=g_strPlayImage;
  397.             play.hoverImage=g_strPlayHover;
  398.             play.downImage=g_strPlayDown;
  399.             play.upToolTip="res://wmploc.dll/RT_STRING/#1800";
  400.             play.enabled=true;
  401.             ffwd.down=false;
  402.             rew.down=false;
  403.         break;
  404.         
  405.     case psPaused:
  406.             QualityIcon.visible=true;
  407.             QualityIcon.image = "res://wmploc.dll/RT_IMAGE/paused.gif";
  408.             QualityIcon.upToolTip = "";
  409.             play.image=g_strPlayImage;
  410.             play.disabledImage=g_strPlayImage;
  411.             play.hoverImage=g_strPlayHover;
  412.             play.downImage=g_strPlayDown;
  413.             play.upToolTip="res://wmploc.dll/RT_STRING/#1800";
  414.             play.enabled=true;
  415.             ffwd.down=false;
  416.             rew.down=false;
  417.         break;
  418.         
  419.     case psPlaying:
  420.             ForceMetaData(0);
  421.             UpdateReceptionQuality();
  422.             tracktime.visible=true;
  423.             play.image=g_strPauseUp;
  424.             play.disabledImage=g_strPauseUp;
  425.             play.hoverImage=g_strPauseHover;
  426.             play.downImage=g_strPauseDown;
  427.             play.upToolTip="res://wmploc.dll/RT_STRING/#1801";
  428.             play.enabled=!g_fIsLiveBroadcast;
  429.             ffwd.down=false;
  430.             rew.down=false;
  431.         break;
  432.         
  433.     case psWaiting:
  434.             UpdateReceptionQuality();
  435.             play.Image=g_strPauseUp;
  436.             play.disabledImage=g_strPauseUp;
  437.             play.hoverImage=g_strPauseHover;
  438.             play.downImage=g_strPauseDown;
  439.             play.upToolTip="res://wmploc.dll/RT_STRING/#1801";
  440.             play.enabled=!g_fIsLiveBroadcast;
  441.             rew.down=false;
  442.             ffwd.down=false;
  443.         break;
  444.         
  445.     case psScanForward:
  446.             UpdateReceptionQuality();
  447.             play.Image=g_strPlayImage;
  448.             play.hoverImage=g_strPlayHover;
  449.             play.disabledImage=g_strPlayImage;
  450.             play.downImage=g_strPlayDown;
  451.             play.upToolTip="res://wmploc.dll/RT_STRING/#1800";
  452.             play.enabled=true;
  453.             rew.down=false;
  454.             ffwd.down=true;
  455.         break;
  456.         
  457.     case psScanReverse:
  458.             UpdateReceptionQuality();
  459.             play.Image=g_strPlayImage;
  460.             play.hoverImage=g_strPlayHover;
  461.             play.disabledImage=g_strPlayImage;
  462.             play.downImage=g_strPlayDown;
  463.             play.upToolTip="res://wmploc.dll/RT_STRING/#1800";
  464.             play.enabled=true;
  465.             rew.down=true;
  466.             ffwd.down=false;
  467.         break;
  468.         
  469.     case psBuffering:
  470.             play.image=g_strPlayImage;
  471.             play.disabledImage=g_strPlayImage;
  472.             play.hoverImage=g_strPlayHover;
  473.             play.downImage=g_strPlayDown;
  474.             play.upToolTip="res://wmploc.dll/RT_STRING/#1800";
  475.             play.enabled=true;
  476.             QualityIcon.image = "res://wmploc.dll/RT_IMAGE/buffering.gif";
  477.             QualityIcon.upToolTip="";
  478.         break;
  479.     }
  480. }
  481.  
  482. function OnOpenStateChangeTransport()
  483. {
  484.     var temp, str, strType;
  485.     
  486.     g_osOpenState = player.OpenState;
  487.  
  488.     switch (g_osOpenState)
  489.     {
  490.     case osUndefined:
  491.         tracktime.visible=false;
  492.         g_fIsLiveBroadcast=false;
  493.         break;
  494.         
  495.     case osPlaylistChanging:
  496.         break;
  497.  
  498.     case osPlaylistLocating:
  499.         break;
  500.  
  501.     case osPlaylistConnecting:
  502.         break;
  503.  
  504.     case osPlaylistLoading:
  505.         break;
  506.  
  507.     case osPlaylistOpening:
  508.         break;
  509.  
  510.     case osPlaylistOpenNoMedia:
  511.         break;
  512.  
  513.     case osPlaylistChanged:
  514.         break;
  515.  
  516.     case osMediaChanging:
  517.         QualityIcon.visible = false;
  518.         break;
  519.  
  520.     case osMediaLocating:
  521.         QualityIcon.visible=true;
  522.         QualityIcon.image = "res://wmploc.dll/RT_IMAGE/locating.gif";
  523.         QualityIcon.upToolTip="";
  524.         break;
  525.  
  526.     case osMediaConnecting:
  527.     QualityIcon.visible=true;
  528.     QualityIcon.image = "res://wmploc.dll/RT_IMAGE/locating.gif"; // uses same image as Locating
  529.     QualityIcon.upToolTip="";
  530.         break;
  531.  
  532.     case osMediaLoading:
  533.         break;
  534.  
  535.     case osMediaWaiting:
  536.     g_fIsLiveBroadcast = (player.currentMedia.getItemInfo("Type") == "broadcast");
  537.     seek.enabled = !g_fIsLiveBroadcast;
  538.         break;
  539.  
  540.     case osMediaOpening:
  541.         QualityIcon.visible=true;
  542.         QualityIcon.image = "res://wmploc.dll/RT_IMAGE/opening.gif";
  543.         QualityIcon.upToolTip="";
  544.         break;
  545.  
  546.     case osMediaOpen: 
  547.         tracktime.visible=true;
  548.     g_fIsLiveBroadcast = (player.currentmedia.getiteminfo("Type") == "broadcast");
  549.     seek.enabled = !g_fIsLiveBroadcast;
  550.         break;
  551.  
  552.     case osBeginLicenseAcquisition:
  553.         break;
  554.  
  555.     case osEndLicenseAcquisition:
  556.         break;
  557.  
  558.     case osBeginIndividualization:
  559.         break;
  560.  
  561.     case osEndIndividualization:
  562.         break;
  563.  
  564.     default:
  565.         break;
  566.     }    
  567. }
  568.